#/usr/bin/env python

"""

Miscellaneous non-gui utilities for roomaker

"""

import glob
import os.path


def delete_room_files():
    """Remove all LPC files from output dir"""
    temps = glob.glob("output/*.c")
    for filename in temps:
        os.unlink(filename)

def read_template(filename):
    """Return contents of template file in a list"""
    template_path = "%s%s" % (query_template_dir(), filename)
    return open(template_path, "r").readlines()

def query_template_dir():
    """Get template directory"""
    return "template/"

def query_templates():
    """Return list of all available template files"""
    temps = glob.glob("template/*.tmpl")
    files = []
    for filename in temps:
        files.append(os.path.basename(filename))
    files.sort()
    return files

